package com.yuke.cloud.service.api.pmc.service;

import com.alibaba.fastjson.JSONObject;
import com.yuke.cloud.common.security.feign.OAuth2FeignAutoConfiguration;
import com.yuke.cloud.common.util.wrapper.Wrapper;
import com.yuke.cloud.service.api.pmc.dto.*;
import com.yuke.cloud.service.api.pmc.service.hystrix.PmcFeignHystrix;
import com.yuke.cloud.service.api.smc.dto.ShopInfoDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "yuke-cloud-service-pmc", configuration = OAuth2FeignAutoConfiguration.class,
        fallback = PmcFeignHystrix.class
        ,path = "${yuke.feign-path-pmc}")

public interface PmcFeignApi {

    @GetMapping("/pmc/api/spec")
    ProdSpecInfoDto getSpecInfoDtoBySpecId(@RequestParam("specId") Long specId);
    @GetMapping("/pmc/api/productSpec")
    Wrapper<String> getSpecNameBySpecId(@RequestParam("specId") Long specId);
    @GetMapping("/pmc/api/categoryId")
    List<ProdSpecInfoDto> getSpecInfoDtosByCategoryId(@RequestParam("categoryId") Long categoryId);
    @PostMapping("/pmc/api/condition")
    Wrapper<List<ProdSpecInfoDto>> getSpecInfoDtosByCondition(@RequestBody ProdSpecInfoDto prodSpecInfoDto);
    @GetMapping("/pmc/api/specs")
    List<ProdSpecInfoDto> getSpecInfoDtosBySpecIds(@RequestParam("specIds") String specIds);
    @GetMapping("/pmc/api/category")
    List<ProdCategoryDto> getCategorysBySpecId(@RequestParam("specId") Long specId);
    @PostMapping("/pmc/api/categorys")
    List<ProdCategoryDto> getCategorysBySpecIds(@RequestBody List<Long> specIds);
    //销售指导价和出厂价
    @GetMapping("/pmc/api/price")
    JSONObject getPriceBySpecId(@RequestParam("specId") Long specId);
    @GetMapping("/pmc/api/region")
    Wrapper<String> getRegionNameByRegionId(@RequestParam("regionId") Long regionId);
    @PostMapping("/pmc/api/regions")
    List<ShopInfoDto> getRegionNameByRegionIds(@RequestBody List<ShopInfoDto> shopInfoDtos);
    @PostMapping("/pmc/api/specName")
    List<ProdSpecInfoDto> getSpecBySpecName(@RequestBody ProdSpecInfoDto prodSpecInfoDto);
    @PostMapping("/pmc/api/prod")
    List<ProdSpecInfoDto> getProdNameByProductId(@RequestBody List<Long> productIds);
    //为prodSpec设置出厂价格
    @PutMapping("/pmc/api/stockPrice")
    Wrapper updateSpecStockPrice(@RequestBody ProdSpecInfoDto prodSpecInfoDto);
    @PostMapping("/pmc/api/regionDetail")
    Wrapper<List<RegionInfoDto>> getRegionIntroduceInfoByIds(@RequestBody List<Long> regionIds);
    @PostMapping("/pmc/api/factoryDetail")
    Wrapper<List<FactoryInfoDto>> getFactoryDetail(@RequestBody List<Long> factoryIds);
    @PutMapping("/pmc/api/saleCount")
    Wrapper updateSpecSaleCount(@RequestBody List<ProdSpecInfoDto> prodSpecInfoDtos);

    @PostMapping("/pmc/api/getSpecBySpecIds")
    Wrapper<List<ProdSpecInfoExDto>> getSpecBySpecIds(@RequestParam("shopId") Long shopId, @RequestBody List<Long> specIds, @RequestParam("saleType") Byte saleType);

    @PostMapping("/pmc/api/getSpecIds")
    List<ProdSpecInfoExDto> getSpecIds(@RequestBody ProdStorageDto prodStorageDto);

    @PostMapping("/pmc/api/getProvinceAndCityInfoByCityId")
    RegionInfoDto getProvinceAndCityInfoByCityId(@RequestBody Long cityId);

    @GetMapping("/pmc/api/getImportSpecId")
    List<ProdSpecInfoDto> getImportSpecId(@RequestParam("specName")String specName);

    @PostMapping("/pmc/api/getSpecDtosBySpecIds")
    List<ProdSpecInfoDto> getSpecDtosBySpecIds(@RequestBody List<Long> specIds);

    @PostMapping("/pmc/api/getAppSpecInfoBySpecIds")
    List<ProdSpecInfoExDto> getAppSpecInfoBySpecIds(@RequestBody List<Long> specIds);

    @PostMapping("/pmc/api/getFindProdAttribute")
    List<ProdAttributeDto> getFindProdAttribute(@RequestBody List<Long> specIds);

    @PostMapping("/pmc/api/getSpecInfoBySpecIds")
    List<ProdSpecInfoDto> getSpecInfoBySpecIds(@RequestBody List<Long> specIds);

    @PostMapping("/pmc/api/getRegionNameByCountyIds")
    List<Map> getRegionNameByCountyIds(@RequestBody List<Long> countyIds);

    /*
    * 10/16
    * 找出某一个类下的商品*/
    @PostMapping("/pmc/api/getSpecIdByCategoryId")
    List<ProdSpecInfoDto> getSpecIdByCategoryId(@RequestBody ProdCategoryDto prodCategoryDto);

    //10/17 只查询出spec信息
    @PostMapping("/pmc/api/getSpecNameBySpecIds")
    List<ProdSpecApiDto> getSpecNameBySpecIds(@RequestBody List<Long> list);

    /*
    11/12
    只查询出子节点信息
     */
    @PostMapping("/pmc/api/findLeaf")
    List<Long> findLeaf(@RequestBody ProdCategoryDto prodCategoryDto);

    /*
    12/10
    查出父节点Id及名称
    */
    @PostMapping("/pmc/api/findParent")
    List<ProdSpecApiDto> findParent(@RequestBody List<Long> list);

    /*
    01/30
    核对条形码
    */
    @PostMapping("/pmc/api/checkSpeCode")
    List<ProdSpecApiDto> checkSpeCode(@RequestBody List<String> specCode);
}
